CREATE TABLE [dbo].[BANK_BACK](
	[back_money2] [money] NULL DEFAULT 0,
	[lotteryid] [nvarchar](50) NULL,
	[b_befor] [money] NULL,
	[expect] [nvarchar](500) NULL,
	[follows] [nvarchar](500) NULL,
	[b_after] [money] NULL,
	[username] [nvarchar](100) NULL,
	[back_money] [money] NULL DEFAULT 0,
	[addtime] [datetime] NULL DEFAULT getdate(),
	[prostate] [nvarchar](50) NULL  DEFAULT (N'正常'),
	[id] [bigint] IDENTITY(1,1) primary key NOT NULL,
	[type] [nvarchar](50) NULL,
	[state] [int] NULL
)

GO
CREATE TABLE [dbo].[CSJL] (
	[id] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[SF_ID] [int] NULL ,
	[CSMC] [nvarchar] (50) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DLRZ] (
	[YZM] [nvarchar] (30) NULL ,
	[ZT] [int] NULL ,
	[LLQ] [nvarchar] (255) NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[KHD_IP] [nvarchar] (50) NULL ,
	[DLSJ] [datetime] NULL ,
	[ZH] [nvarchar] (50) NULL ,
	[ZHLX] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[GLY] (
	[ZT] [int] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[ZH] [nvarchar] (50) NULL ,
	[MM] [varchar] (30) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[JJFDCK] (
	[WC_ZEFD] [nvarchar] (50) NULL ,
	[SC_BDWJJ] [money] NULL ,
	[SC_HZJJ] [money] NULL ,
	[bonus29] [money] NULL ,
	[SC_DWDJJ] [money] NULL ,
	[WC_DWDJJ] [money] NULL ,
	[WC_WXZXJJ] [money] NULL ,
	[BCSJ] [datetime] NULL ,
	[WC_WXQYJJ] [money] NULL ,
	[SC_BDWFD] [nvarchar] (50) NULL ,
	[WC_BDWJJ] [money] NULL ,
	[WC_HZJJ] [money] NULL ,
	[SC_ZSJJ] [money] NULL ,
	[SC_HYJJ] [money] NULL ,
	[WC_HYJJ] [money] NULL ,
	[WC_BDWFD] [nvarchar] (50) NULL ,
	[WC_ZLFD] [nvarchar] (50) NULL ,
	[SC_ZEFD] [nvarchar] (50) NULL ,
	[SC_QEJJ] [money] NULL ,
	[WC_HEFD] [nvarchar] (50) NULL ,
	[WC_HZFD] [nvarchar] (50) NULL ,
	[SC_ZXJJ] [money] NULL ,
	[WC_HYFD] [nvarchar] (50) NULL ,
	[SC_ZSFD] [nvarchar] (50) NULL ,
	[SC_HEJJ] [money] NULL ,
	[WC_ZLJJ] [money] NULL ,
	[SC_ZLFD] [nvarchar] (50) NULL ,
	[WC_ZSFD] [nvarchar] (50) NULL ,
	[WC_ZEJJ] [money] NULL ,
	[WC_DWDFD] [nvarchar] (50) NULL ,
	[SC_ZXFD] [nvarchar] (50) NULL ,
	[WC_WXQEFD] [nvarchar] (50) NULL ,
	[WC_WXQEJJ] [money] NULL ,
	[WC_WXQYFD] [nvarchar] (50) NULL ,
	[SC_QYFD] [nvarchar] (50) NULL ,
	[rate29] [nvarchar] (50) NULL ,
	[SC_HYFD] [nvarchar] (50) NULL ,
	[WC_SXZXJJ] [money] NULL ,
	[WC_SXZXFD] [nvarchar] (50) NULL ,
	[SC_ZLJJ] [money] NULL ,
	[SC_QEFD] [nvarchar] (50) NULL ,
	[SC_DWDFD] [nvarchar] (50) NULL ,
	[SC_HZFD] [nvarchar] (50) NULL ,
	[WC_ZSJJ] [money] NULL ,
	[SC_ZEJJ] [money] NULL ,
	[SC_HEFD] [nvarchar] (50) NULL ,
	[SC_QYJJ] [money] NULL ,
	[WC_DXDSFD] [nvarchar] (50) NULL ,
	[WC_HEJJ] [money] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[WC_DXDSJJ] [money] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SC_JJSD] (
	[HEDS] [decimal](18, 2) NULL ,
	[ZXHZ] [decimal](18, 2) NULL ,
	[QEDS] [decimal](18, 2) NULL ,
	[ZSFS] [decimal](18, 2) NULL ,
	[BDW] [decimal](18, 2) NULL ,
	[HEFS] [decimal](18, 2) NULL ,
	[ZXFS] [decimal](18, 2) NULL ,
	[SCMS] [varchar] (30) NULL ,
	[ZU_XHZ] [decimal](18, 2) NULL ,
	[HYFS] [decimal](18, 2) NULL ,
	[DWD] [decimal](18, 2) NULL ,
	[ZXDS] [decimal](18, 2) NULL ,
	[HHZX] [decimal](18, 2) NULL ,
	[QEFS] [decimal](18, 2) NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[ZLFS] [decimal](18, 2) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SC_SJGL] (
	[QSJZSJ] [datetime] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[SFTZXS] [int] NULL ,
	[XSQS] [int] NULL ,
	[CJKSSJ] [datetime] NULL ,
	[DGJSSJ] [datetime] NULL ,
	[YXMS] [varchar] (30) NULL ,
	[XXTS] [int] NULL ,
	[DGKSSJ] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SC_ZJXX] (
	[KJSJ] [datetime] NULL ,
	[BCSJ] [datetime] NULL ,
	[KJHM3] [nvarchar] (10) NULL ,
	[QH] [nvarchar] (50) NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[YXMS] [varchar] (30) NULL ,
	[KJHM2] [nvarchar] (10) NULL ,
	[KJHM1] [nvarchar] (10) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SFJL] (
	[id] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[SFMC] [nvarchar] (255) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[TZJL] (
	[YXLX] [nvarchar] (50) NULL ,
	[DQJE] [nvarchar] (50) NULL ,
	[SFFH] [int] NULL ,
	[DZZT] [nvarchar] (50) NULL ,
	[ZJTZZH] [int] NULL ,
	[YHM] [nvarchar] (50) NULL ,
	[QH] [nvarchar] (50) NULL ,
	[DGSJ] [datetime] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[CZFL] [varchar] (30) NULL ,
	[XL] [varchar] (30) NULL ,
	[ZJHM] [varchar] (100) NULL ,
	[SFZH] [int] NULL ,
	[TGYZ] [int] NULL ,
	[ZHQS] [int] NULL ,
	[TZHM] [nvarchar] (500) NULL ,
	[DCTJZJE] [nvarchar] (50) NULL ,
	[ZJJE] [nvarchar] (50) NULL ,
	[ZJZT] [nvarchar] (30) NULL ,
	[BS] [nvarchar] (10) NULL ,
	[ZHM] [nvarchar] (50) NULL ,
	[DZH] [nvarchar] (50) NULL ,
	[YJF] [nvarchar] (10) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[USERS] (
	[qq] [nvarchar] (100) NULL ,
	[rate_A2] [nvarchar] (50) NULL ,
	[lock] [int] NULL ,
	[username] [nvarchar] (50) NULL ,
	[rate_A1] [nvarchar] (50) NULL ,
	[addtime] [datetime] NULL ,
	[tel] [nvarchar] (50) NULL ,
	[bank_num] [nvarchar] (100) NULL ,
	[tiyan] [int] NULL ,
	[islock] [int] NULL ,
	[addlim] [int] NULL ,
	[emailid] [int] NULL ,
	[daili] [int] NULL ,
	[mss] [nvarchar] (50) NULL ,
	[email] [nvarchar] (50) NULL ,
	[userpass1] [nvarchar] (100) NULL ,
	[rate_B2] [nvarchar] (50) NULL ,
	[lastlogout] [datetime] NULL ,
	[rate_C2] [nvarchar] (50) NULL ,
	[rate_C1] [nvarchar] (50) NULL ,
	[logip] [nvarchar] (50) NULL ,
	[savetime] [datetime] NULL ,
	[limit] [money] NULL ,
	[addnum] [int] NULL ,
	[rate_B1] [nvarchar] (50) NULL ,
	[userpass] [nvarchar] (100) NULL ,
	[uermoney] [money] NULL ,
	[bank_area] [nvarchar] (100) NULL ,
	[regfrom] [nvarchar] (500) NULL ,
	[allmoney] [money] NULL ,
	[bank_name] [nvarchar] (200) NULL ,
	[logtime] [datetime] NULL ,
	[nickname] [nvarchar] (50) NULL ,
	[logins] [int] NULL ,
	[icemoney] [money] NULL ,
	[bank_bank] [nvarchar] (100) NULL ,
	[onlinetime] [datetime] NULL ,
	[state] [int] NULL ,
	[id] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[rate_a3] [varchar] (50) NULL ,
	[rate_a4] [varchar] (50) NULL ,
	[rate_b3] [varchar] (50) NULL ,
	[rate_b4] [varchar] (50) NULL ,
	[rate_c3] [varchar] (50) NULL ,
	[rate_c4] [varchar] (50) NULL ,
	[control] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WC_JJSD] (
	[HSHZ] [decimal](18, 2) NULL ,
	[DXDS] [decimal](18, 2) NULL ,
	[QSZS] [decimal](18, 2) NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[HEZE] [decimal](18, 2) NULL ,
	[HSZXFS] [decimal](18, 2) NULL ,
	[HSZXDS] [decimal](18, 2) NULL ,
	[QSZH] [decimal](18, 2) NULL ,
	[HSZS] [decimal](18, 2) NULL ,
	[QEFS] [decimal](18, 2) NULL ,
	[WCMS] [varchar] (30) NULL ,
	[QSZXDS] [decimal](18, 2) NULL ,
	[QEDS] [decimal](18, 2) NULL ,
	[HEFS] [decimal](18, 2) NULL ,
	[HSZL] [decimal](18, 2) NULL ,
	[HSZX] [decimal](18, 2) NULL ,
	[HEDS] [decimal](18, 2) NULL ,
	[DWD] [decimal](18, 2) NULL ,
	[QSZL] [decimal](18, 2) NULL ,
	[HSZH] [decimal](18, 2) NULL ,
	[QSZX] [decimal](18, 2) NULL ,
	[QSZXFS] [decimal](18, 2) NULL ,
	[QSBDW] [decimal](18, 2) NULL ,
	[HSBDW] [decimal](18, 2) NULL ,
	[QSHZ] [decimal](18, 2) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WC_SJGL] (
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[QSJZSJ] [datetime] NULL ,
	[DGKSSJ] [datetime] NULL ,
	[DGJSSJ] [datetime] NULL ,
	[SFTZXS] [int] NULL ,
	[YXMS] [varchar] (30) NULL ,
	[QH] [nvarchar] (50) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WC_ZJXX] (
	[QH] [nvarchar] (50) NULL ,
	[KJHM4] [nvarchar] (10) NULL ,
	[KJHM2] [nvarchar] (10) NULL ,
	[KJHM3] [nvarchar] (10) NULL ,
	[KJHM1] [nvarchar] (10) NULL ,
	[BCSJ] [datetime] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[YXMS] [varchar] (30) NULL ,
	[KJHM5] [nvarchar] (50) NULL ,
	[KJSJ] [datetime] 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WFLX] (
	[id] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[WFJC] [nvarchar] (30) NULL ,
	[WFJCZWM] [nvarchar] (50) NULL ,
	[DZJE] [decimal](18, 2) NULL ,
	[CZLX] [varchar] (20) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WZGG] (
	[GGNR] [nvarchar] (3000) NULL ,
	[BCSJ] [datetime] NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[GGLX] [nvarchar] (20) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[WZPZ] (
	[FSYX] [nvarchar] (50) NULL ,
	[SFKF] [int] NULL ,
	[QKSM] [nvarchar] (255) NULL ,
	[WZMC] [nvarchar] (50) NULL ,
	[HYZXFD] [float] NULL ,
	[DLM] [nvarchar] (50) NULL ,
	[ZFBZH] [nvarchar] (50) NULL ,
	[ZFBYHM] [nvarchar] (50) NULL ,
	[MTQKCS] [int] NULL ,
	[SFKQZFB] [int] NULL ,
	[JZDL_IP] [text] NULL ,
	[GHZH] [nvarchar] (50) NULL ,
	[CKZSJE] [money] NULL ,
	[ZXRS] [int] NULL ,
	[QQYX] [nvarchar] (50) NULL ,
	[SFKQYJTZ] [int] NULL ,
	[ZSQKJE] [money] NULL ,
	[SFKQGH] [int] NULL ,
	[CKSM] [nvarchar] (255) NULL ,
	[YJFWQDZ] [nvarchar] (50) NULL ,
	[CFTYHMC] [nvarchar] (50) NULL ,
	[HYZDFD] [float] NULL ,
	[DLMM] [nvarchar] (50) NULL ,
	[QKSJXZ_JS] [int] NULL ,
	[FSSXSM] [nvarchar] (50) NULL ,
	[SFKQCFT] [int] NULL ,
	[QKSJXZ_KS] [int] NULL ,
	[GHYHM] [nvarchar] (50) NULL ,
	[CFTZH] [nvarchar] (50) NULL ,
	[ID] [int] IDENTITY (1, 1) PRIMARY KEY ,
	[SFYXDJXJ] [int] NULL ,
	[SFYXGXJCZ] [int] NULL ,
	[XJBZJSFD] [int] NULL 
) ON 
GO
create table [Yhxx] (
 [ID] int not null identity,
 [TITLE] varchar(50) not null,
 [CONTENT] varchar(255) not null,
 [ADDTIME] datetime not null default getdate(),
 [MSGTYPE] [varchar] (10) NOT NULL ,
 [USERNAME] varchar(20) not null,
 [STATE] int not null default 0,
 primary key (ID)
 ) 
go


CREATE TABLE [dbo].[Xxtx] (
	[cktx] [int] NOT NULL DEFAULT 1 ,
	[fdtx] [int] NOT NULL DEFAULT 1,
	[id] [int] IDENTITY (1, 1) PRIMARY KEY NOT NULL ,
	[pjtx] [int] NOT NULL DEFAULT 1 ,
	[qktx] [int] NOT NULL DEFAULT 1,
	[username] [varchar] (30) NOT NULL 
) 
GO

create procedure [dbo].[spPageObject]
@sql nvarchar(4000),
@pageNo int=1,
@pageSize int,
@pageCount int=0 out,
@recordCount int=0 out
as
declare @usetime datetime
set @usetime=getdate()
set nocount on
begin
declare @p1 int
exec sp_cursoropen @p1 output,@sql,@scrollopt=1,@ccopt=1,@rowcount=@pagecount output
set @recordCount = @pageCount
select @pagecount=ceiling(1.0*@pagecount/@pagesize),@pageNo=(@pageNo-1)*@pagesize+1
exec sp_cursorfetch @p1,16,@pageNo,@pagesize
exec sp_cursorclose @p1
end;


USE [XinLuDB]
GO
/****** Object:  StoredProcedure [dbo].[www5007cn]    Script Date: 06/14/2011 00:14:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[www5007cn]
 @username  nvarchar(50),
 @type  varchar(50),
 @addmoney money,
 @oldmoney  money,
 @nowmoney  money,
 @pro_num varchar(50),
 @cpnum varchar(50),
 @bz int,
 @states int
AS
   SET NOCOUNT ON
  DECLARE @tt nvarchar(50)
   DECLARE @cd nvarchar(50)
if (@bz=0)
	begin
	set @tt='发起代购:'
	 insert into bank_back(username,type,back_money,b_befor,b_after,lotteryid,follows,state,expect) values(@username,@type,@addmoney,@oldmoney, @nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum)
             end
if(@bz=1)
	begin
	  set @tt='用户撤单:'
               set @cd='已撤单'
              insert into bank_back(username,type,back_money2,b_befor,b_after,lotteryid,follows,state,expect,prostate) values(@username,@type,@addmoney,@oldmoney,@nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum,@cd)
	end 
if(@bz=2)
	begin
	  set @tt='系统撤单:'
               set @cd='已撤单'
              insert into bank_back(username,type,back_money2,b_befor,b_after,lotteryid,follows,state,expect,prostate) values(@username,@type,@addmoney,@oldmoney,@nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum,@cd)
             end
if(@bz=3)
	begin
	  set @tt='系统返点:'
	 insert into bank_back(username,type,back_money2,b_befor,b_after,lotteryid,follows,state,expect) values(@username,@type,@addmoney,@oldmoney,@nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum)  
             end 
if(@bz=4)
	begin
	  set @tt='系统返奖:'
	 insert into bank_back(username,type,back_money2,b_befor,b_after,lotteryid,follows,state,expect) values(@username,@type,@addmoney,@oldmoney,@nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum)  
             end 
if(@bz=5)
	begin
	  set @tt='系统派奖:'
	 insert into bank_back(username,type,back_money2,b_befor,b_after,lotteryid,follows,state,expect) values(@username,@type,@addmoney,@oldmoney,@nowmoney,@pro_num,@tt+@cpnum,@states,@cpnum)  
             end

